<template>
	<view class="price-public">
		<u-table v-if='dataList.length' border-color='#fff'>
			<u-tr>
				<u-th>名称</u-th>
				<u-th>单位</u-th>
				<u-th>规格</u-th>
				<u-th>价格</u-th>
			</u-tr>
			<u-tr v-for="(item, i) in dataList" :key='i'>
				<u-td>{{item.name}}</u-td>
				<u-td>{{item.xmdw}}</u-td>
				<u-td>{{item.xmgg}}</u-td>
				<u-td>{{item.xmdj}}</u-td>
			</u-tr>
		</u-table>
		<u-empty text="暂无数据" mode="list" v-else></u-empty>
		<Load :load="load" />
	</view>
</template>

<script>
	import { getPricePub } from '@/api/home.js'
	import Load from '@/components/Load/index.vue'
	export default {
		components:{ Load },
		data() {
			return {
				dataList:[],
				load:false
			}
		},
		onLoad() {
			this.initData()
		},
		methods: {
			initData(){
				this.load = true
				getPricePub().then(data => {
					this.load = false
					this.dataList = data||[]
				}).catch(e => {
					this.load = false
					this.dataList = []
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.price-public{
		height: 100%;
		background-color: $uni-bg-color;
	}
</style>
